package org.apache.rmiloader.action;

//import org.apache.log4j.Logger;
import java.util.List;
import java.util.Set;

import org.apache.rmiloader.util.RmiLoaderConfig;

import com.opensymphony.xwork2.ActionSupport;

public class IndexAction extends ActionSupport {

	private static final long serialVersionUID = 8736018338496403716L;
	/** Logger Initialization */
    // private Logger logger = Logger.getLogger(IndexAction.class);
    
	private String version;
    private String author;
    private String build;
    private String date;
    
    private RmiReport report;
    private RmiLoaderConfig config; 
    
	public String execute() throws Exception {
		config = RmiLoaderConfig.getInstance();
        report = RmiReport.getInstance();
		
		version = config.getProperty(RmiLoaderConfig.VERSION);
		author = config.getProperty(RmiLoaderConfig.AUTHOR);
		build = config.getProperty(RmiLoaderConfig.BUILD);
		date = config.getProperty(RmiLoaderConfig.BUILD_DATE);
		return SUCCESS;
    }
	
	// called by tag <s:property>
	
	
	// FOOTER
	public String getVersion() {
		return version;
	}

	public String getAuthor() {
		return author;
	}

	public String getBuild() {
		return build;
	}

	public String getDate() {
		return date;
	}
	
	// MAIN
	public String getPort() {
		return config.getProperty(RmiLoaderConfig.RMI_PORT);
	}
	
	public String getHost() {
		return config.getProperty(RmiLoaderConfig.RMI_HOST);	
	}
	
	public String getTime() {
		return report.getLoadingTime();
	}
	
	public Set<RmiBean> getRmiBeans() {
		return report.getRmiBeans();
	}
	
}
